#define _CRT_SECURE_NO_WARNINGS 1



#include<stdio.h>


int main()
{
	int arr[5][5] = { 0 }, i = 0, j = 0, a[5] = { 0 }, b[5] = { 0 }, max = 0, min = 0;
	for (i = 0; i < 5; i++)
	{
		max = arr[i][0];
		for (j = 0; j < 5; j++)
		{
			scanf("%d", &arr[i][j]);
			if (arr[i][j] > max)
				max = arr[i][j];
		}
		a[i] = max;
	}
	for (i = 0; i < 5; i++)
	{
		min = arr[0][i];
		for (j = 0; j < 5; j++)
		{
			if (arr[j][i] < min)
				min = arr[j][i];
		}
		b[i] = min;
	}
	min = max = 0;
	for (i = 0; i < 5; i++)
	{
		if (a[i] < a[min])
			min = i;
		if (b[i] > b[max])
			max = i;
	}
	if (a[min] == b[max])
		printf("%d %d %d\n", min + 1, max + 1, a[min]);
	else
		printf("not found\n");

	return 0;
}